package com.rw.coco.handler.message.reply;

import com.rw.coco.handler.message.event.CocoMessageEvent;

public class AdvancedReplyHandler implements ReplyHandler {
    private final ReplyHandler replyHandler;

    public AdvancedReplyHandler(ReplyHandler replyHandler) {
        this.replyHandler = replyHandler;
    }

    /**
     * 触发的条件
     */
    @Override
    public boolean trigger(CocoMessageEvent cocoMessageEvent) {
        if (cocoMessageEvent.hasPrefix()) {
            return replyHandler.trigger(cocoMessageEvent);
        }
        return false;
    }


    @Override
    public void handler(CocoMessageEvent cocoMessageEvent) {
        replyHandler.handler(cocoMessageEvent);
    }

    @Override
    public int priority() {
        return replyHandler.priority();
    }
}